<template>
  <div class="wrapper" :class="{is_fixed:isFixed}">
    <div class="head-title">
      <h3>小米</h3>
    </div>

    <div class="pro-param">
      <a href="javascript:;">概述</a>
      <span>|</span>
      <a href="javascript:;">参数</a>
      <span>|</span>
      <a href="javascript:;">用户评价</a>
      <slot name="btn"></slot>
    </div>
  </div>
</template>

<script>
export default {
  name: "ProductHead",
  data(){
    return{
      isFixed:false
    }
  },
  mounted() {
    document.addEventListener('scroll',this.innerHeight)
  },
  methods:{
    innerHeight(){
      let scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
     this.isFixed= scrollTop > 152 ? true:false;
    }
  }
}
</script>

<style lang="scss" scoped>
@import '../../assets/scss/mixin.scss';
@import '../../assets/scss/config.scss';
.wrapper{
  @include flex();
  padding:0 10px;
  box-sizing: border-box;
  height: 70px;
  line-height: 70px;
  border-top: 1px solid #e5e5e5;
  background-color: #ffffff;
  &.is_fixed{
    position: fixed;
    top:0;
    width:1126px;
    box-shadow: 0 5px 5px $colorE;
    z-index: 100;
  }
  .head-title{
    h3{
      font-size: 16px;
    }
  }
  .pro-param{
    font-size: 14px;
    a{
      color: #666666;
    }
    span{
      display: inline-block;
      margin:0 5px;
    }
    div{
      display: inline-block;
      margin-left: 10px;
      width: 110px;
      line-height: 30px;
      background-color: #FF6600;
      color: #ffffff;
      text-align: center;
      cursor: pointer;
    }
  }
}
</style>
